package br.com.agiledev.webscrum.action;

import java.util.Arrays;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

import br.com.agiledev.webscrum.entity.Team;

@SuppressWarnings("serial")
@Name("teamSearchMB")
@Scope(ScopeType.PAGE)
public class TeamSearchAction extends QueryAction<Team> {

    private static final String EJBQL = "select sp from Team sp";
    private static final String[] RESTRICTIONS = {"lower(sp.nome) like lower(concat(#{teamSearchMB.team.nome}, '%'))"};
    private static final String ORDER_COLUMN = "sp.nome";
    
    Team team;
    
    public TeamSearchAction() {
	setEjbql(EJBQL);
	setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
	setOrder(ORDER_COLUMN);
    }

    public Team getTeam() {
	if(team == null) {
	    team = new Team();
	}
        return team;
    }

    public void setTeam(Team team) {
        this.team = team;
    }
    
    
}